package com.lyf.boot.modules.index.controller;

import com.lyf.boot.core.model.R;
import com.lyf.boot.modules.index.entity.dto.SmsDto;
import com.lyf.boot.modules.index.service.ISmsService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信接口
 * @author Luyufan
 * @date 2023/7/5 19:00
 */
@RestController
@RequestMapping("sms")
@RequiredArgsConstructor
public class SmsController {

    private final ISmsService smsService;

    /**
     * 发送短信
     * @param dto 短信参数
     * @return 发送结果
     */
    @PostMapping("send")
    public R<Void> sendSms(@RequestBody @Valid SmsDto dto){
        smsService.sendSms(dto);
        return R.ok();
    }
}
